<template>
	<view>
		<navbar :parameter="parameter"></navbar>

		<view class="top-box">
			<view class="">可提现金额（元）</view>
			<view class="number">
				￥
				<text>{{ commission }}</text>
			</view>
		</view>
		<view class="wap">
			<view class="box">
				<view class="">提现金额</view>
				<view class="input-line acea-row row-bottom">
					<text>￥</text>
					<input type="text" v-model="amount" value="" />
					<view class="" @click="amount = commission">全部提现</view>
				</view>
				<view class="acea-row row-between-wrapper">
					<view class="">提现至</view>
					<u-radio-group v-model="radiovalue" placement="row" @change="change" activeColor="#1F83FF">
						<u-radio
							:customStyle="{ marginLeft: '20px' }"
							v-for="(item, index) in list"
							:key="index"
							:label="item.value"
							:name="item.name"
							labelSize="14"
							labelColor="#000"
						></u-radio>
					</u-radio-group>
				</view>

				<!-- <view class="" v-if="way == 1">
					<input type="text" class="account" v-model="name" placeholder="请输入姓名" placeholder-style="color:rgba(0,0,0,.22)" />
					<input type="number" class="account" v-model="zfb_account" value="" placeholder="请输入支付宝账号" placeholder-style="color:rgba(0,0,0,.22)" />
				</view>
				<view class="" v-else>
					<input type="number" class="account" v-model="weixin_account" value="" placeholder="请输入微信账号" placeholder-style="color:rgba(0,0,0,.22)" />
				</view> -->
				<view class="btn-box">
					<view class="btn" @click="submit">申请提现</view>
				</view>
				<view class="tips">注：提现最低限额为500元</view>
			</view>
		</view>

		<!-- 提示 -->
		<u-toast ref="uToast"></u-toast>
	</view>
</template>
<script>
let app = getApp();
export default {
	data() {
		return {
			parameter: {
				navbar: '1',
				return: '1',
				title: '我的佣金',
				color: true,
				class: 'transparent'
			},
			commission: '345.00',
			amount: '',
			radiovalue: '2',
			list: [
				{
					name: '2',
					value: '微信'
				},
				// {
				// 	name: '1',
				// 	value: '支付宝'
				// }
			],
			way: 2,
			name: '',
			weixin_account: '',
			zfb_account: ''
		};
	},
	onLoad(option) {
		this.commission = option.commission;
	},
	onShow() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function () {},
	onShareTimeline(res) {
		//分享到朋友圈
	},
	methods: {
		change(name) {
			console.log('gender', name);
			this.way = name;
		},
		async applyWithdraw(account) {
			const res = await this.$myRequest({
				url: '/api/user/applyWithdraw',
				data: {
					openid: uni.getStorageSync('openid'),
					type_data: this.way,
					// account: account,
					money: this.amount
				}
			});
			if (res.data.status == 200) {
				this.$refs.uToast.show({
					type: 'success',
					message: '提交成功',
					complete() {
						uni.navigateBack();
					}
				});
			}
		},
		submit() {
			var account;
			if (this.way == 1) {
				console.log(1);
				account = this.zfb_account;
			} else {
				console.log(2);
				account = this.weixin_account;
			}
			console.log(account);
			this.applyWithdraw(account);
		}
	}
};
</script>

<style lang="scss" scoped>
.top-box {
	position: absolute;
	left: 0;
	width: 100%;
	top: 0;
	z-index: 1;
	background: linear-gradient(-85deg, #1f83ff, #61b1ff);
	height: 500rpx;
	padding: 30rpx;
	padding-top: 180rpx;
	color: #fff;
}

.top-box .number {
	font-size: 36rpx;
	margin-top: 30rpx;
}

.top-box .number text {
	font-size: 70rpx;
}

.wap {
	position: absolute;
	left: 0;
	width: 100%;
	top: 350rpx;
	padding: 30rpx;
	z-index: 2;
}

.box {
	background-color: #fff;
	border-radius: 18rpx;
	padding: 30rpx;
	padding-bottom: 60rpx;
}

.input-line {
	margin: 40rpx 0;
	border-bottom: 1px solid #e3e3e3;
	padding-bottom: 30rpx;
}

.input-line text {
	color: #020202;
	font-size: 80rpx;
	line-height: 1;
}

.input-line input {
	flex: 1;
	font-size: 36rpx;
}

.input-line view {
	color: #2185ff;
	font-size: 28rpx;
}

.account {
	height: 100rpx;
	border-bottom: 1px solid #e3e3e3;
	margin-top: 20rpx;
}

.btn-box {
	padding-top: 60rpx;
	padding-bottom: 30rpx;
}

.btn-box .btn {
	width: 100%;
	height: 80rpx;
	border-radius: 10rpx;
	line-height: 80rpx;
	text-align: center;
	background-color: #1f83ff;
	color: #fff;
	font-size: 32rpx;
}
.tips {
	font-size: 24rpx;
}
</style>
